package com.base.andlanggl.render

import android.content.Context
import android.opengl.GLSurfaceView
import com.base.andlanggl.filter.QgqGame2
import com.base.andlanggl.filter.QgqGame3
import com.base.andlanggl.filter.QgqGame4
import javax.microedition.khronos.egl.EGLConfig
import javax.microedition.khronos.opengles.GL10

/**
 * GL 渲染器
 */
class LangGLRender(context: Context) : GLSurfaceView.Renderer {
    private val qgqGame:QgqGame4 by lazy { QgqGame4(context) } //曲棍球
    override fun onSurfaceCreated(p0: GL10?, p1: EGLConfig?) {
        //初始化曲棍球数据
        qgqGame.initGame()
    }

    override fun onSurfaceChanged(p0: GL10?, width: Int, height: Int) {
        //设置画布宽高
        qgqGame.drawViewport(width,height)
    }

    override fun onDrawFrame(p0: GL10?) {
        //绘制曲棍球
        qgqGame.drawGame()
    }
}